package com.books.controller.forgetpassword;

import com.books.model.bo.Result;
import com.books.service.login_regis.IUserLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/forget")
public class ForgetPasswordController {

    @Autowired
    private IUserLoginService userLoginService;

    @GetMapping("/forget")
    public String index01Book(){return "/forgetpassword/forgetpassword";
    }

    @GetMapping("/newPassword")
    @ResponseBody
    public Result newPassword(String email,String newPassword){
        userLoginService.updateUserPwd(newPassword,email);
        return new Result("200","修改成功");
    }
}
